package com.rectcircle.wechat.vo;

import java.util.LinkedList;
import java.util.List;

public class WxJsConfig {
	public static final String JS_API_ONMENUSHARETIMELINE="onMenuShareTimeline";
	public static final String JS_API_ONMENUSHAREAPPMESSAGE="onMenuShareAppMessage";
	public static final String JS_API_ONMENUSHAREQQ="onMenuShareQQ";
	public static final String JS_API_ONMENUSHAREWEIBO="onMenuShareWeibo";
	public static final String JS_API_ONMENUSHAREQZONE="onMenuShareQZone";
	public static final String JS_API_STARTRECORD="startRecord";
	public static final String JS_API_STOPRECORD="stopRecord";
	public static final String JS_API_ONVOICERECORDEND="onVoiceRecordEnd";
	public static final String JS_API_PLAYVOICE="playVoice";
	public static final String JS_API_PAUSEVOICE="pauseVoice";
	public static final String JS_API_STOPVOICE="stopVoice";
	public static final String JS_API_ONVOICEPLAYEND="onVoicePlayEnd";
	public static final String JS_API_UPLOADVOICE="uploadVoice";
	public static final String JS_API_DOWNLOADVOICE="downloadVoice";
	public static final String JS_API_CHOOSEIMAGE="chooseImage";
	public static final String JS_API_PREVIEWIMAGE="previewImage";
	public static final String JS_API_UPLOADIMAGE="uploadImage";
	public static final String JS_API_DOWNLOADIMAGE="downloadImage";
	public static final String JS_API_TRANSLATEVOICE="translateVoice";
	public static final String JS_API_GETNETWORKTYPE="getNetworkType";
	public static final String JS_API_OPENLOCATION="openLocation";
	public static final String JS_API_GETLOCATION="getLocation";
	public static final String JS_API_HIDEOPTIONMENU="hideOptionMenu";
	public static final String JS_API_SHOWOPTIONMENU="showOptionMenu";
	public static final String JS_API_HIDEMENUITEMS="hideMenuItems";
	public static final String JS_API_SHOWMENUITEMS="showMenuItems";
	public static final String JS_API_HIDEALLNONBASEMENUITEM="hideAllNonBaseMenuItem";
	public static final String JS_API_SHOWALLNONBASEMENUITEM="showAllNonBaseMenuItem";
	public static final String JS_API_CLOSEWINDOW="closeWindow";
	public static final String JS_API_SCANQRCODE="scanQRCode";
	public static final String JS_API_CHOOSEWXPAY="chooseWXPay";
	public static final String JS_API_OPENPRODUCTSPECIFICVIEW="openProductSpecificView";
	public static final String JS_API_ADDCARD="addCard";
	public static final String JS_API_CHOOSECARD="chooseCard";
	public static final String JS_API_OPENCARD="openCard";
	
	
	private boolean debug;
	private String appId;
	private long timestamp;
	private String nonceStr;
	private String signature;
	private List<String> jsApiList = new LinkedList<>();
	public WxJsConfig() {
	}
	public WxJsConfig(boolean debug, String appId, long timestamp, String nonceStr, String signature) {
		this.debug = debug;
		this.appId = appId;
		this.timestamp = timestamp;
		this.nonceStr = nonceStr;
		this.signature = signature;
	}
	
	public void addJsApi(String str){
		if(jsApiList==null){
			jsApiList = new LinkedList<>();
		}
		jsApiList.add("'"+str+"'");
	}
	
	public void addAllJsApi(){
		addJsApi(JS_API_ONMENUSHARETIMELINE);
		addJsApi(JS_API_ONMENUSHAREAPPMESSAGE);
		addJsApi(JS_API_ONMENUSHAREQQ);
		addJsApi(JS_API_ONMENUSHAREWEIBO);
		addJsApi(JS_API_ONMENUSHAREQZONE);
		addJsApi(JS_API_STARTRECORD);
		addJsApi(JS_API_STOPRECORD);
		addJsApi(JS_API_ONVOICERECORDEND);
		addJsApi(JS_API_PLAYVOICE);
		addJsApi(JS_API_PAUSEVOICE);
		addJsApi(JS_API_STOPVOICE);
		addJsApi(JS_API_ONVOICEPLAYEND);
		addJsApi(JS_API_UPLOADVOICE);
		addJsApi(JS_API_DOWNLOADVOICE);
		addJsApi(JS_API_CHOOSEIMAGE);
		addJsApi(JS_API_PREVIEWIMAGE);
		addJsApi(JS_API_UPLOADIMAGE);
		addJsApi(JS_API_DOWNLOADIMAGE);
		addJsApi(JS_API_TRANSLATEVOICE);
		addJsApi(JS_API_GETNETWORKTYPE);
		addJsApi(JS_API_OPENLOCATION);
		addJsApi(JS_API_GETLOCATION);
		addJsApi(JS_API_HIDEOPTIONMENU);
		addJsApi(JS_API_SHOWOPTIONMENU);
		addJsApi(JS_API_HIDEMENUITEMS);
		addJsApi(JS_API_SHOWMENUITEMS);
		addJsApi(JS_API_HIDEALLNONBASEMENUITEM);
		addJsApi(JS_API_SHOWALLNONBASEMENUITEM);
		addJsApi(JS_API_CLOSEWINDOW);
		addJsApi(JS_API_SCANQRCODE);
		addJsApi(JS_API_CHOOSEWXPAY);
		addJsApi(JS_API_OPENPRODUCTSPECIFICVIEW);
		addJsApi(JS_API_ADDCARD); 
		addJsApi(JS_API_CHOOSECARD);
		addJsApi(JS_API_OPENCARD);	
	}
	
	public String getAppId() {
		return appId;
	}
	public List<String> getJsApiList() {
		return jsApiList;
	}
	public String getNonceStr() {
		return nonceStr;
	}
	public String getSignature() {
		return signature;
	}
	public long getTimestamp() {
		return timestamp;
	}
	public boolean isDebug() {
		return debug;
	}
	public void setAppId(String appId) {
		this.appId = appId;
	}
	public void setDebug(boolean debug) {
		this.debug = debug;
	}

	public void setNonceStr(String nonceStr) {
		this.nonceStr = nonceStr;
	}
	public void setSignature(String signature) {
		this.signature = signature;
	}
	public void setTimestamp(long timestamp) {
		this.timestamp = timestamp;
	}
	@Override
	public String toString() {
		return "wx.config({debug:" + debug + ", appId:'" + appId + "', timestamp:" + timestamp + ", nonceStr:'" + nonceStr
				+ "', signature:'" + signature + "', jsApiList:" + jsApiList + "});";
	}
	
}
